﻿using Microsoft.AspNetCore.Mvc;

namespace PageOffice6_Net_Core.Controllers.ExcelInsertImage
{
    public class ExcelInsertImageController : Controller
    {
        public IActionResult Excel()
        {
            PageOfficeNetCore.PageOfficeCtrl poCtrl = new PageOfficeNetCore.PageOfficeCtrl(Request);

            PageOfficeNetCore.Excel.WorkbookWriter worbBook = new PageOfficeNetCore.Excel.WorkbookWriter();
            PageOfficeNetCore.Excel.SheetWriter Sheetl = worbBook.OpenSheet("Sheet1");
            PageOfficeNetCore.Excel.ExcelCellWriter cell1 = Sheetl.OpenCell("A1");
            cell1.Value = "[image]/ExcelInsertImage/image/logo.jpg[/image]";
            poCtrl.SetWriter(worbBook);
            //打开Excel文档
            poCtrl.WebOpen("doc/test.xls", PageOfficeNetCore.OpenModeType.xlsNormalEdit, "tom");
            ViewBag.poCtrl = poCtrl.GetHtml();
            return View();
        }

    }
}